package com.sjd.dao;

import com.sjd.pojo.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@Repository
//部门dao
public class DepartmentDao {
    //模拟数据库中的数据
    private static Map<Integer, Department> departments=null;
    static {
        departments=new HashMap<Integer,Department>();
        departments.put(10,new Department(10,"教学部"));
        departments.put(11,new Department(11,"市场部"));
        departments.put(12,new Department(12,"教研部"));
        departments.put(13,new Department(13,"运营部"));
        departments.put(13,new Department(14,"后勤部"));
    }

    //获得所有部门信息
    public Collection<Department> getDepartments(){
        return departments.values();
    }
    //通过id得到部门
    public Department getDepartmentById(Integer id){
        return departments.get(id);
    }

}
